package com.jk.bgorder.controller;

import com.jk.bgorder.entity.IndentEntity;
import com.jk.bgorder.service.IndentService;
import com.jk.damaicommon.entity.GoodsEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.util.List;


@RestController
@RequestMapping("ordersCheck")
public class Indentcontroller{

    @Autowired
    private IndentService indentService;

    /* @Value("${server.port}")
     String port;
 */
  /*  @RequestMapping("test")
    public Object test(String name){
        return  "你好"+name+"你方问的端口是"+port;
    }*/
    //查询未付款
    @RequestMapping("pandingOrders")
    public List<IndentEntity> pandingOrders(IndentEntity indent){
        return  indentService.pandingOrders(indent);
    }
    //查询全部
    @RequestMapping(value = "allOrders",method = RequestMethod.POST)
    public List<IndentEntity> allOrders(@RequestBody IndentEntity indent) throws ParseException {
        return  indentService.allOrders(indent);
    }
    //回显
    @RequestMapping("orderQuery")
    public IndentEntity orderQuery(String id){
        return  indentService.orderQuery(id);
    }
    //新增
    @RequestMapping("addtest")
    public void addtest(IndentEntity indent){
        indentService.addtest(indent);
    }
    //查询预期的商品
    @RequestMapping(value = "expectGoods",method = RequestMethod.POST)
    public List<GoodsEntity> expectGoods(@RequestBody GoodsEntity goods){
        return  indentService.expectGoods(goods);
    }
}
